import * as fs from 'fs';

interface Properties {
  [key: string]: string;
}

function readProperties(filePath: string): Properties {
  const fileContent = fs.readFileSync(filePath, 'utf-8');
  const lines = fileContent.split('\n');
  const properties: Properties = {};

  for (const line of lines) {
    const trimmedLine = line.trim();
    if (trimmedLine && !trimmedLine.startsWith('#')) {
      const [key, value] = trimmedLine.split('=');
      properties[key.trim()] = value.trim();
    }
  }

  return properties;
}

// 使用示例
const propertiesFilePath = './gcfg.properties';
const properties = readProperties(propertiesFilePath);
console.log(properties);